<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>Title</title>
</head>

<script>


    function method(obj) {
        var wuJiaoXing = document.getElementsByName("wuJiaoXing");
        for (var i = 0; i < wuJiaoXing.length; i++) {
            wuJiaoXing[i].innerText="☆"
        }for (var i = 0; i < obj; i++) {
            wuJiaoXing[i].innerText="★"
        }
    }

</script>

<body>
<span name="wuJiaoXing" onclick="method(1)">☆</span>&nbsp
<span name="wuJiaoXing" onclick="method(2)">☆</span>&nbsp
<span name="wuJiaoXing" onclick="method(3)">☆</span>&nbsp
<span name="wuJiaoXing" onclick="method(4)">☆</span>&nbsp
<span name="wuJiaoXing" onclick="method(5)">☆</span>&nbsp
</body>
</html>
